home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Skunkware 5
/
Skunkware 5.iso
/
man
/
cat.1
/
calc.1
< prev
next >
Wrap
Text File
|
1995-07-25
|
10KB
|
331 lines
ccccaaaallllcccc((((1111)))) 11115555nnnnoooovvvv99993333 ((((^^^^........^^^^)))) ccccaaaallllcccc((((1111))))
NNNNAAAAMMMMEEEE
calc - arbitrary precision calculator
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
calc [ -h ] [ -q ] [ _c_a_l_c__c_m_d ... ]
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
CALC COMMAND LINE
-h Print a help message. This option implies -q. This
is equivalent to the calc command help help.
-q Disable the use of the $CALCRC startup library scripts.
Without calc_cmds, calc operates interactively. If one or
more calc_cmds are given on the command line, calc will
execute them and exit.
Normally on startup, calc attempts to execute a collection
of library scripts. The environment variable $CALCRC (if
non-existent then a compiled in value) contains a :
separated list of startup library scripts. No error
conditions are produced if these startup library scripts are
not found.
Filenames are subject to ``~'' expansion (see below). The
environment variable $CALCPATH (if non-existent then a
compiled in value) contains a : separated list of search
directories. If a file does not begin with /, ~ or ./, then
it is searched for under each directory listed in the
$CALCPATH. It is an error if no such readable file is
found.
For more information use the following calc commands:
help usage
help help
help environment
OVERVIEW
Calc is arbitrary precision arithmetic system that uses a
C-like language. Calc is useful as a calculator, an
algorithm prototyped and as a mathematical research tool.
More importantly, calc provides one with a machine
independent means of computation.
Calc comes with a rich set of builtin mathematical and
programmatic functions.
Calc is distributed with library of scripts. Written in the
Page 1 (printed 7/11/94)
ccccaaaallllcccc((((1111)))) 11115555nnnnoooovvvv99993333 ((((^^^^........^^^^)))) ccccaaaallllcccc((((1111))))
same C-like language, library scripts may be read in and
executed during a calc session. These library scripts are
also provided because they are useful and to serve as
examples of the calc language. One may further extend calc
thru the use of user defined scripts.
Internally calc represents numeric values as fractions
reduced to their lowest terms. The numerators and
denominators of these factions may grow to arbitrarily large
values. Numeric values read in are automatically converted
into rationals. The user need not be aware of this internal
representation.
For more information use the following calc commands:
help intro
help builtin
help stdlib
help define
show builtins
show functions
DATA TYPES
Fundamental builtin data types include integers, real
numbers, rational numbers, complex numbers and strings.
By use of an object, one may define an arbitrarily complex
data types. One may define how such objects behave a wide
range of operations such as addition, subtraction,
multiplication, division, negation, squaring, modulus,
rounding, exponentiation, equality, comparison, printing and
so on.
For more information use the following calc commands:
help types
help obj
show objfuncs
VARIABLES
Variables in calc are typeless. In other words, the
fundamental type of a variable is determined by its content.
Before a variable is assigned a value it has the value of
zero.
The scope of a variable may be global, local to a file, or
local to a procedure. Values may be grouped together in a
matrix, or into a a list that permits stack and queue style
operations.
Page 2 (printed 7/11/94)
ccccaaaallllcccc((((1111)))) 11115555nnnnoooovvvv99993333 ((((^^^^........^^^^)))) ccccaaaallllcccc((((1111))))
For more information use the following calc commands:
help variable
help mat
help list
show globals
INPUT/OUTPUT
A leading ``0x'' implies a hexadecimal value, a leading
``0b'' implies a binary value, and a ``0'' followed by a
digit implies an octal value. Complex numbers are indicated
by a trailing ``i'' such as in ``3+4i''. Strings may be
delimited by either a pair of single or double quotes. By
default, calc prints values as if they were floating point
numbers. One may change the default to print values in a
number of modes including fractions, integers and
exponentials.
A number of stdio-like file I/O operations are provided.
One may open, read, write, seek and close files. Filenames
are subject to ``~'' expansion to home directories in a way
similar to that of the Korn or C-Shell.
For example:
~/.calcrc
~chongo/lib/fft_multiply.cal
For more information use the following calc command:
help file
CALC LANGUAGE
The calc language is a C-like language. The language
includes commands such as variable declarations,
expressions, tests, labels, loops, file operations, function
calls. These commands are very similar to their
counterparts in C.
The language also include a number of commands particular to
calc itself. These include commands such as function
definition, help, reading in library scripts, dump files to
a file, error notification, configuration control and
status.
For more information use the following calc command:
help command
help statement
help expression
Page 3 (printed 7/11/94)
ccccaaaallllcccc((((1111)))) 11115555nnnnoooovvvv99993333 ((((^^^^........^^^^)))) ccccaaaallllcccc((((1111))))
help operator
help config
FFFFIIIILLLLEEEESSSS
/usr/skunk/lib/calc/*.cal
library scripts shipped with calc
/usr/skunk/lib/calc/help/*
help files
/usr/skunk/lib/calc/bindings
command line editor bindings
EEEENNNNVVVVIIIIRRRROOOONNNNMMMMEEEENNNNTTTT
CALCPATH
A :-separated list of directories used to search for
scripts filenames that do not begin with /, ./ or ~.
Default value: .:./lib:~/lib:/usr/skunk/lib/calc
CALCRC
On startup (unless -h or -q was given on the command
line), calc searches for files along this :-separated
environment variable.
Default value: /usr/skunk/lib/calc/startup:~/.calcrc
CALCBINDINGS
On startup (unless -h or -q was given on the command
line), calc reads key bindings from the filename
specified by this environment variable.
Default value: /usr/skunk/lib/calc/bindings
CCCCRRRREEEEDDDDIIIITTTT
Written by David I. Bell.
Thanks for suggestions and encouragement from Peter Miller,
Neil Justusson, and Landon Noll.
Portions of this program are derived from an earlier set of
public domain arbitrarily precision routines which was
posted to the net around 1984. By now, there is almost no
recognizable code left from that original source.
Most of this source and binary is:
Copyright (c) 1993 David I. Bell
Page 4 (printed 7/11/94)
ccccaaaallllcccc((((1111)))) 11115555nnnnoooovvvv99993333 ((((^^^^........^^^^)))) ccccaaaallllcccc((((1111))))
Some files are a copyrighted David I. Bell and Landon Noll.
Permission is granted to use, distribute, or modify this
source, provided that this copyright notice remains intact.
Send calc comments, suggestions, bug fixes, enhancements and
interesting calc scripts that you would like you see
included in future distributions to:
dbell@canb.auug.org.au chongo@toad.com
Enjoy!
Page 5 (printed 7/11/94)